import baseRequest from "@/utils/request";

/**
 * 重写request
 * @param config
 * @returns {Promise | Promise<unknown>}
 */
const request = function (config) {
  config.baseURL = process.env.VUE_APP_BASE_API + '/shippingPlan'
  return baseRequest(config)
}

export function getPlanData(){
  return request({
    url: '/getPlanData',
  })
}

export function getShippingPlanList(params = {}){
  return request({
    url: '/getShippingPlanList',
    params,
  })
}

export function getShippingPlanInfo(id){
  return request({
    url: `/getShippingPlanInfo/${id}`,
    handleError: true,
  })
}

/**
 * 删除货件单
 * @param id
 * @returns {Promise|Promise<*>}
 */
export function delShippingShipment(id){
  return request({
    url: `/delShippingShipment/${id}`,
    method: 'delete',
    handleError: true,
  })
}

/**
 * 修改仓库
 * @param data
 * @returns {Promise|Promise<*>}
 */
export function editWarehouse(data){
  return request({
    url: '/editWarehouse',
    method: 'put',
    data,
  })
}
